package com.xbongbong.paas.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import lombok.Getter;

/**
 * @author 吴峰
 * @version v1.0
 * @date 2019/3/28 20:15
 * @since v1.0
 */
@Getter
public enum  VisibleTypeEnum {

    /**
     * 高级可见类型枚举
     */
    NOT_SHOW_ANYONE(1, "enum.visibleType.memo.not_show_anyone", "enum.visibleType.editMemo.not_show_anyone"),

    SOME_PEOPLE_CAN_SEE(2, "enum.visibleType.memo.some_people_can_see", "enum.visibleType.editMemo.some_people_can_see"),

    NONE(404, "enum.visibleType.memo.none", "enum.visibleType.editMemo.none"),
    ;

    private Integer type;

    private String memo;

    private String editMemo;

    VisibleTypeEnum(Integer type, String memo, String editMemo) {
        this.type = type;
        this.memo = memo;
        this.editMemo = editMemo;
    }

    public static VisibleTypeEnum getByType(Integer type) {
        for (VisibleTypeEnum visibleTypeEnum :values()) {
            if (visibleTypeEnum.getType().equals(type)) {
                return visibleTypeEnum;
            }
        }
        return NONE;
    }

    public String getMemo() {
        return I18nMessageUtil.getMessage(memo);
    }

    public String getEditMemo() {
        return I18nMessageUtil.getMessage(editMemo);
    }
}
